package some.member.dao;

import java.util.List;
import java.util.Map;

import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Component;

import some.member.domain.MemberCommand;
@Component
public class MemberDaoImpl extends SqlSessionDaoSupport implements MemberDao{

	@Override
	public List<MemberCommand> getMemberList(Map<String, Object> map) {
		List<MemberCommand> list = getSqlSession().selectList("someMemberDao.getMemberList",map);
		return list;
	}

	@Override
	public int getMemberCount() {
		Integer count = getSqlSession().selectOne("someMemberDao.getMemberCount");
		return count;
	}

	@Override
	public void joinMember(MemberCommand memberCommand) {
		getSqlSession().insert("someMemberDao.joinMember",memberCommand);
	}

	@Override
	public MemberCommand getMember(String id) {
		MemberCommand memberCommand = getSqlSession().selectOne("someMemberDao.getMember",id);
		return memberCommand;
	}

	@Override
	public void modifyMember(MemberCommand member) {
		getSqlSession().update("someMemberDao.modifyMember",member);
	}

	@Override
	public void deleteMember(String id) {
		getSqlSession().delete("someMemberDao.deleteMember",id);
		
	}

	@Override
	public String loginMemberCheck(String id) {
		String dbPassword = getSqlSession().selectOne("someMemberDao.loginMemberCheck", id);
		return dbPassword;
	}

	@Override
	public String getGender(String id) {
		String gender = getSqlSession().selectOne("someMemberDao.getGender",id);
		return gender;
	}

	@Override
	public int idDoubleCheck(String id) {
		int idDoubleCheck = getSqlSession().selectOne("someMemberDao.idDoubleCheck",id);
		return idDoubleCheck;
	}

	@Override
	public void updateP_id(Map<String, Object> ps) {
		getSqlSession().update("updateP_id",ps);
	}

	@Override
	public String getMemberName(String id) {
		String name = getSqlSession().selectOne("someMemberDao.getMemberName",id);
		return name;
	}

	@Override
	public String checkP_id(String id) {
		return getSqlSession().selectOne("someMemberDao.checkP_id", id);
	}
	
	@Override
	public void modifyGrade(String id) {
		getSqlSession().update("someMemberDao.modifyGrade",id);
	}

	@Override
	public MemberCommand getMemberIdPw(Map<String,String> map) {
		MemberCommand memberCommand = getSqlSession().selectOne("someMemberDao.getMemberIdPw",map);
		return memberCommand;
	}

	@Override
	public List<MemberCommand> getMemberSearchList(Map<String, Object> map) {
		List<MemberCommand> list = getSqlSession().selectList("someMemberDao.getMemberSearchList",map);
		return list;
	}

	@Override
	public int getMemberSearchCount(Map<String, Object> map) {
		Integer count = getSqlSession().selectOne("someMemberDao.getMemberSearchCount",map);
		return count;
	}

	@Override
	public void updateListview(Map<String,Object> map) {
		getSqlSession().update("someMemberDao.updateListview",map);
	}

	@Override
	public String getListView(String id) {
		return getSqlSession().selectOne("someMemberDao.getListView",id);
	}

	@Override
	public int getGrade(String id) {
		return getSqlSession().selectOne("someMemberDao.getGrade",id);
	}


}
